//
//  MKTChatBubbleView.m
//  MKUITestApp
//
//  Created by 苏尚进 on 2021/7/15.
//  Copyright © 2021 moon. All rights reserved.
//

#import "MKTChatBubbleView.h"

@implementation MKTChatBubbleView

- (id)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        self.clipsToBounds = YES;
        self.layer.cornerRadius = 5;
        
        self.bgView = [[UIImageView alloc] init];
        self.bgView.contentMode = UIViewContentModeScaleToFill;
        self.bgView.backgroundColor = [UIColor colorWithRed:0 green:0.5 blue:1 alpha:1];
        [self addSubview:self.bgView];
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    CGRect bounds = self.bounds;
    //
    self.bgView.frame = bounds;
    //
    self.containerLayout.bounds = bounds;
    [self.containerLayout layoutItemsWithResizeItems:YES];
}
- (CGSize)sizeThatFits:(CGSize)size{
    CGSize s = [self.containerLayout sizeThatFits:size resizeItems:YES];
    if(self.fixWidth){
        s.width = size.width;
    }
    return s;
}
+ (UIEdgeInsets)defaultContentInsets{
    return UIEdgeInsetsMake(15, 15, 15, 15);
}
@end
